package com.greenzebras.geocache.datastore.persistence;

public final class GeocacheDataServiceConstants {
	/*
	 * SQL Query constants
	 */
	public static final String EQUALS = " = ";
	public static final String LIKE = " LIKE ";
	public static final String IN = " IN ";
	public static final String OR = " OR ";
	public static final String LIMIT = " LIMIT ";
	public static final String SPACE = " ";
	public static final String WILDCARD = "%";
	public static final String QUOTE = "\"";
	public static final String LPAREN = "(";
	public static final String RPAREN = ")";
	
	/*
	 * Database constants.
	 */
	public static final String DATABASE_NAME = "geocache.db";
	public static final int DATABASE_VERSION = 1;

	/*
	 * Cache table constants
	 */
	public static final String CACHE_TABLE_NAME = "cache";
	public static final String CACHE_COLUMN_ID = "_id";
	public static final String CACHE_COLUMN_NAME = "name";
	public static final String CACHE_COLUMN_DESCRIPTION = "description";
	public static final String CACHE_COLUMN_COORD_LAT = "coord_lat";
	public static final String CACHE_COLUMN_COORD_LONG = "coord_long";
	public static final String CACHE_COLUMN_TYPE = "type";
	public static String ALL_CACHE_COLUMNS[] = { CACHE_COLUMN_ID,
			CACHE_COLUMN_NAME, CACHE_COLUMN_DESCRIPTION,
			CACHE_COLUMN_COORD_LAT, CACHE_COLUMN_COORD_LONG, CACHE_COLUMN_TYPE };
	public static String CACHE_TABLE_CREATE = "CREATE TABLE "
			+ CACHE_TABLE_NAME + "( " + CACHE_COLUMN_ID
			+ " INTEGER PRIMARY KEY AUTOINCREMENT, " + CACHE_COLUMN_NAME
			+ " TEXT NOT NULL, " + CACHE_COLUMN_DESCRIPTION + " TEXT, "
			+ CACHE_COLUMN_COORD_LAT + " INTEGER, " + CACHE_COLUMN_COORD_LONG
			+ " INTEGER, " + CACHE_COLUMN_TYPE + " TEXT NOT NULL);";
	/* Should probably be ordered based on distance away from current location */
	public static final String CACHE_ORDER_BY = CACHE_COLUMN_NAME + " ASC";

	/*
	 * User table constants
	 */
	public static final String USER_TABLE_NAME = "USER";
	public static final String USER_COLUMN_ID = "_id";
	public static final String USER_COLUMN_NAME = "name";
	public static final String USER_COLUMN_RANK = "rank";
	public static final String USER_COLUMN_EMAIL = "email";
	public static final String USER_COLUMN_PASSWORD = "password";
	public static String ALL_USER_COLUMNS[] = { USER_COLUMN_ID,
			USER_COLUMN_NAME, USER_COLUMN_RANK, USER_COLUMN_EMAIL,
			USER_COLUMN_PASSWORD };
	public static String USER_TABLE_CREATE = "CREATE TABLE " + USER_TABLE_NAME
			+ "( " + USER_COLUMN_ID + " INTEGER PRIMARY KEY AUTOINCREMENT, "
			+ USER_COLUMN_NAME + " TEXT, " + USER_COLUMN_EMAIL
			+ " TEXT NOT NULL, " + USER_COLUMN_RANK + " INTEGER,"
			+ USER_COLUMN_PASSWORD + " TEXT NOT NULL);";
	public static final String USER_ORDER_BY = USER_COLUMN_NAME + " ASC";

	public static final String DATABASE_CREATE = USER_TABLE_CREATE + " "
			+ CACHE_TABLE_CREATE;

}
